package com.mazaiting.mybatisplus.sensitive.handler;

import com.mazaiting.mybatisplus.sensitive.ISensitive;
import com.mazaiting.mybatisplus.sensitive.constants.RegexConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 邮箱脱敏处理器
 * @title: EmailSensitive
 * @Author danghailiang
 * @Date: 2022/4/13 10:09
 * @Version 1.0
 */
public class EmailSensitiveHandler implements ISensitive {
    /**
     * 日志服务
     */
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public String paramSensitive(Object value) {
        String metaData = value.toString();
        logger.info("metaData:{}",metaData);
        String data = metaData.replaceAll(RegexConstant.REGEX_EMAIL, RegexConstant.REPLACE_STAR);
        logger.info("data:{}",data);
        return data;
    }
}
